package cn.iot.controller.sys;

import cn.iot.common.dto.ResultMsg;
import cn.iot.sys.service.SysBedService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/sys/bed")
public class SysBedController {
    @Autowired
    private SysBedService sysBedService;
    private Logger logger = LoggerFactory.getLogger(getClass());

    @PostMapping("getBedByHostelId")
    public ResultMsg getBedByHostelId(@RequestParam int id){
        logger.info("SysBedController getBedByHostelId id{}",id);
        ResultMsg msg = sysBedService.getBedByHostelId(id);
        logger.debug("SysBedController getBedByHostelId msg{}",msg);
        return msg;
    }

    @PostMapping("addHostelByStuId")
    public ResultMsg addHostelByStuId(@RequestParam Map<String,Object> map){
        logger.info("SysBedController addHostelByStuId map{}",map);
        ResultMsg msg = sysBedService.addHostelByStuId(map);
        logger.debug("SysBedController addHostelByStuId msg{}",msg);
        return msg;
    }

    @PostMapping("delStuBedById")
    public ResultMsg delStuBedById(@RequestParam Map<String,Object> map){
        logger.info("SysBedController delStuBedById map{}",map);
        ResultMsg msg = sysBedService.delStuBedById(map);
        logger.debug("SysBedController delStuBedById msg{}",msg);
        return msg;
    }
}
